<?php

/**
 * 用户评价系统Action类
 *
 * @author chacha
 * @date 2016-9-2
 */
class UserCommentAction extends CommonAction{
    
    public function _empty() {
        $tpl = "../Include/App/Group/Bridge/Tpl/Public_404.html";
        $this->display($tpl);
    }
    
    public function __construct() {
        parent::__construct();
    }
    
    /**
     * 评价接口
     */
    public function comment_ajax() {
        $becommented = I('uid',0);
        $job = I('job',0);
        $rate1 = I('rate1',0);
        $rate2 = I('rate2',0);
        $rate3 = I('rate3',0);
        $rate4 = I('rate4',0);
        $content = I('content',0);
        import('ORG.Util.Verify');
        if (Verify::isEmpty($becommented)==false
            || Verify::isEmpty($job)==false
            || Verify::isEmpty($rate1)==false
            || Verify::isEmpty($rate2)==false
            || Verify::isEmpty($rate3)==false
            || Verify::isEmpty($rate4)==false
            || Verify::isEmpty($content)==false) {
            $this->ajaxf('参数错误!');
        }
        $comment = array(
            'uid'=>$becommented,
            'author'=>  $this->uid,
            'job'=>$job,
            'rate1'=>$rate1,
            'rate2'=>$rate2,
            'rate3'=>$rate3,
            'rate4'=>$rate4,
            'content'=>$content,
        );
        $commentDao = new CommentModel($this->uid);
        $ret = $commentDao->comment($comment);
        if ($ret['success']===false) {
            $this->ajaxf($ret['msg']);
        }
        else {
            $this->ajaxs();
        }
    }
}
